﻿using System.Collections.Generic;
using DCS.Business.Model;
using DCS.Business.Model.PublishUsage;
using System;

namespace DCS.DataProvider
{
	public interface IDataProvider
	{
		#region DCSFile

		/// <summary>
		/// 
		/// </summary>
		/// <returns></returns>
		//List<string> GetRecentFileNames(int recentDays);
       
        //modify at 2011-6-3

        /// <summary>
        /// 
        /// </summary>
        /// <param name="recentDays"></param>
        /// <returns></returns>
        Dictionary<string,DateTime> GetRecentFileNames(int recentDays);

        /// <summary>
        /// 删除已经存在的文件列表
        /// </summary>
        /// <param name="xmlFileList"></param>
        void DeleteExitFileList(List<string> fileList,string messageType);

		/// <summary>
		/// 
		/// </summary>
		/// <param name="dCSFile"></param>
		DCSFile CreateDCSFile(DCSFile dCSFile);

		/// <summary>
		/// 
		/// </summary>
		/// <param name="dCSFile"></param>
		void UpdateDCSFile(DCSFile dCSFile);

		/// <summary>
		/// 
		/// </summary>
		/// <param name="fileIds"></param>
		/// <param name="dCSFiles"></param>
		List<DCSFile> GetDCSFilesByMessageType(string messageType, FileStatus status, int rowCount, FileStatus lockStatus, bool fullMatch = true);

		/// <summary>
		/// 
		/// </summary>
		/// <param name="batchSize"></param>
		/// <param name="MessageType"></param>
		/// <returns></returns>
		List<DCSFile> GetDCSFilesGroupByMessageType(string messageType, FileStatus status, int groupCount, FileStatus lockStatus = 0);

		/// <summary>
		/// 
		/// </summary>
		/// <param name="files"></param>
		/// <param name="status"></param>
		void BatchUpdateDCSFilesStatus(int[] ids, FileStatus status);

		/// <summary>
		/// 
		/// </summary>
		/// <param name="batchSize"></param>
		/// <param name="MessageType"></param>
		/// <returns></returns>
		List<DCSFile> GetFilesToParse(int batchSize, string MessageType);

		#endregion

		#region LDMMessage

		LDMMessage CreateLDMMessage(LDMMessage item);

        LDMMessage CreateDistinctLDMMessage(LDMMessage item);

        List<FIDSLDMMsg> GetNewLDMMsg(decimal MaxID);

        List<FlightInfo> GetFlightInfoByPara(DateTime PDate,string Carrier,string FlightNo);

		#endregion

		#region PRLMessage

		PRLMessage CreatePRLMessage(PRLMessage item);

		#endregion

		#region PFSMessage

		PFSMessage CreatePFSMessage(PFSMessage item);

		#endregion

		#region SSRCode

		Dictionary<string, SSRCode> GetSPMLs();

		Dictionary<string, SSRCode> GetSSRs();

		#endregion

		#region Monitor Usage

		List<DCSFileSummary> GetDCSFileSummary(bool groupByDate);

		List<KeyValuePair<string, int>> GetAllTablesRowCount();

		Dictionary<string, FileStatus> GetRecentFileStatus(int recentDays, string messageType);

		#endregion

		#region Common Usage

		/// <summary>
		/// 
		/// </summary>
		/// <typeparam name="T"></typeparam>
		/// <param name="sql"></param>
		/// <returns></returns>
		List<T> QueryModelList<T>(string sql);

		#endregion

		#region Publish Usage

		FlightPassengerInfo GetFlightPassengerInfo(string sql);

		List<DCSFile> GetSyncMessagesByMessageType(out List<PRLMessage> prlList, string messageType, int groupCount);

		List<DCSFile> GetSyncPFSMessagesByMessageType(out List<PFSMessage> pfsList, string messageType, int groupCount);

        void InsertSyncLog(List<ESBSyncLog> logList);

        List<PRLMessage> QueryTripHistory(string sql);

		#endregion

        #region SITAMessage
        int InsertSourceMessage(SITAMessage sourceMessage);

        int GetMaxSourceID(string monthDir);

        ACChangeMessage InsertACChangeMessage(ACChangeMessage model);

        TRChangeMessage InsertTRChangeMessage(TRChangeMessage model);

        CancleMessage InsertCancleMessage(CancleMessage model);

        List<SITAMessage> GetSourceMessageToParse(string messageType, int rowSize, int selectStatus, int updateStatus);

        void UpdateSourceMessageStatus(List<int> idList, FileStatus status);

        void UpdateSourceMessage(SITAMessage sourceMessage);

        #endregion
    }
}
